/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.sd.entity;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import com.jeesite.common.utils.excel.fieldtype.CompanyType;
import com.jeesite.common.utils.excel.fieldtype.OfficeType;
import com.jeesite.modules.sys.entity.Office;

import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 文件复制Entity
 *
 * @author ysj
 * @version 2020-07-02
 */
@Table(name = "sd_doc_deliver_record", alias = "a", columns = {
        @Column(name = "id", attrName = "id", label = "主键", isPK = true),
        @Column(name = "doc_id", attrName = "docId", label = "来文id"),
        @Column(name = "doc_copy_no", attrName = "docCopyNo", label = "文件分发后的编号，分发后，每份件都有编号，格式待确定，如：0 1 2 3", comment = "文件分发后的编号，分发后，每份件都有编号，格式待确定，如：0 1 2 3（0是原件，登记时需要）"),
        @Column(name = "before_take_date", attrName = "beforeTakeDate", label = "截止领取日期"),
        @Column(name = "before_return_date", attrName = "beforeReturnDate", label = "截止归还日期"),
        @Column(name = "recv_unit_code", attrName = "recvUnitCode", label = "收文单位ID"),
        @Column(name = "deliver_type", attrName = "deliverType", label = "分发类型 1", comment = "分发类型 1：分发给拟办单位  2：分发给下级单位"),
        @Column(name = "take_date", attrName = "takeDate", label = "领文时间"),
        @Column(name = "take_user_code", attrName = "takeUserCode", label = "领文人ID"),
        @Column(name = "take_user_name", attrName = "takeUserName", label = "领文人姓名", queryType = QueryType.LIKE),
        @Column(name = "take_user_policeno", attrName = "takeUserPoliceno", label = "领文人警号"),
        @Column(name = "take_user_face", attrName = "takeUserFace", label = "领文人脸识别图片路径"),
        @Column(name = "return_date", attrName = "returnDate", label = "归还日期"),
        @Column(name = "return_user_code", attrName = "returnUserCode", label = "归还人ID"),
        @Column(name = "return_user_name", attrName = "returnUserName", label = "归还人姓名", queryType = QueryType.LIKE),
        @Column(name = "return_user_policeno", attrName = "returnUserPoliceno", label = "归还人警号"),
        @Column(name = "return_user_face", attrName = "returnUserFace", label = "归还人脸识别图片路径"),
        @Column(name = "destroy_task_id", attrName = "destroyTaskId", label = "销毁任务ID"),
        @Column(name = "create_by", attrName = "createBy", label = "创建者", isUpdate = false),
        @Column(name = "create_date", attrName = "createDate", label = "创建时间", isUpdate = false, isQuery = false),
        @Column(name = "update_by", attrName = "updateBy", label = "更新者", isUpdate = true),
        @Column(name = "update_date", attrName = "updateDate", label = "更新时间", isUpdate = true, isQuery = false),
},
        joinTable = {
		@JoinTable(type = Type.LEFT_JOIN, entity = DocRecv.class, alias = "c", on = "c.id=a.doc_id",
                columns = {
                        @Column(includeEntity = DocRecv.class),

                }),
		@JoinTable(type = Type.LEFT_JOIN,entity = Office.class,alias = "o",on="a.recv_unit_code=o.office_code",
		columns = {
				@Column(includeEntity =Office.class),

		})

        },


        orderBy = "a.id DESC"
)
public class DocDeliverRecord extends DataEntity<DocDeliverRecord> {
    @Valid
    @ExcelFields({@ExcelField(
            title = "来文编号",
            attrName = "docRecv.docSysCode",
            align = ExcelField.Align.CENTER,
            sort = 10
    ),@ExcelField(
            title = "文件文号",
            attrName = "docRecv.docFullNum",
            align = ExcelField.Align.CENTER,
            sort = 10
            // fieldType = OfficeType.class
    ),@ExcelField(
            title = "文件分发编号",
            attrName = "docCopyNo",
            align = ExcelField.Align.CENTER,
            sort = 10,
            words = 15
            // fieldType = OfficeType.class
    ),@ExcelField(
            title = "来文时间",
            attrName = "docRecv.docRecvDate",
            align = ExcelField.Align.CENTER,
            sort = 10,
            dataFormat = "yyyy-MM-dd"
            // fieldType = OfficeType.class
    ),@ExcelField(
            title = "文件标题",
            attrName = "docRecv.docTitle",
            align = ExcelField.Align.CENTER,
            sort = 10,
            words = 40
            // fieldType = OfficeType.class
    ),@ExcelField(
            title = "紧急程度",
            attrName = "docRecv.docEmergLvl",
            dictType = "recv_doc_emerg_lvl",
            align = ExcelField.Align.CENTER,
            sort = 10,
            words = 10
            // fieldType = OfficeType.class
    ),@ExcelField(
            title = "密级",
            attrName = "docRecv.secLvl",
            align = ExcelField.Align.CENTER,
            dictType = "recv_sec_lvl",
            sort = 10,
            words = 6
            // fieldType = OfficeType.class
    ),@ExcelField(
            title = "领文单位",
            attrName = "office.officeName",
            align = ExcelField.Align.CENTER,
            sort = 10
            // fieldType = OfficeType.class
    ),@ExcelField(
            title = "领文单位柜号",
            attrName = "office.extend.extendS4",
            align = ExcelField.Align.CENTER,
            sort = 10
            // fieldType = OfficeType.class
    )})
    private static final long serialVersionUID = 1L;
    /**
     * 来文id
     */
    private String docId;
    /**
     * 文件分发后的编号，分发后，每份件都有编号，格式待确定，如：0 1 2 3（0是原件，登记时需要）
     */
    private Integer docCopyNo;
    /**
     * 截止领取日期
     */
    private Date beforeTakeDate;
    /**
     * 截止归还日期
     */
    private Date beforeReturnDate;
    /**
     * 收文单位ID
     */
    private String recvUnitCode;

    /**
     * 分发类型 1：分发给拟办单位  2：分发给下级单位
     */
    private String deliverType;

	/**
	 * 领文时间
	 */
	private Date takeDate;
	/**
	 * 领文人ID
	 */
	private String takeUserCode;
	/**
	 * 领文人姓名
	 */
	private String takeUserName;
	/**
	 * 领文人警号
	 */
	private String takeUserPoliceno;
	/**
	 * 领文人脸识别图片路径
	 */
	private String takeUserFace;
	/**
	 * 归还日期
	 */
	private Date returnDate;
	/**
	 * 归还人ID
	 */
	private String returnUserCode;
	/**
	 * 归还人姓名
	 */
	private String returnUserName;
	/**
	 * 归还人警号
	 */
	private String returnUserPoliceno;
	/**
	 * 归还人脸识别图片路径
	 */
	private String returnUserFace;
	/**
	 * 销毁任务ID
	 */
	private String destroyTaskId;
	/**
	 * 来文登记表
	 */
	private DocRecv docRecv;
	/**
	 * 机构单位表
	 */
	private Office office;



    public DocDeliverRecord() {
        this(null);
    }

    public DocDeliverRecord(String id) {
        super(id);
    }

    @NotBlank(message = "来文id不能为空")
    @Length(min = 0, max = 64, message = "来文id长度不能超过 64 个字符")
    public String getDocId() {
        return docId;
    }

    public void setDocId(String docId) {
        this.docId = docId;
    }

    @NotNull(message = "文件分发后的编号，分发后，每份件都有编号，格式待确定，如：0 1 2 3不能为空")
    public Integer getDocCopyNo() {
        return docCopyNo;
    }

    public void setDocCopyNo(Integer docCopyNo) {
        this.docCopyNo = docCopyNo;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    public Date getBeforeTakeDate() {
        return beforeTakeDate;
    }

    public void setBeforeTakeDate(Date beforeTakeDate) {
        this.beforeTakeDate = beforeTakeDate;
    }

    @JsonFormat(pattern = "yyyy-MM-dd")
    public Date getBeforeReturnDate() {
        return beforeReturnDate;
    }

    public void setBeforeReturnDate(Date beforeReturnDate) {
        this.beforeReturnDate = beforeReturnDate;
    }

    @Length(min = 0, max = 64, message = "收文单位ID长度不能超过 64 个字符")
    public String getRecvUnitCode() {
        return recvUnitCode;
    }

    public void setRecvUnitCode(String recvUnitCode) {
        this.recvUnitCode = recvUnitCode;
    }

    @Length(min = 0, max = 1, message = "分发类型 1长度不能超过 1 个字符")
    public String getDeliverType() {
        return deliverType;
    }

    public void setDeliverType(String deliverType) {
        this.deliverType = deliverType;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getTakeDate() {
        return takeDate;
    }

    public void setTakeDate(Date takeDate) {
        this.takeDate = takeDate;
    }

    @Length(min = 0, max = 64, message = "领文人ID长度不能超过 64 个字符")
    public String getTakeUserCode() {
        return takeUserCode;
    }

    public void setTakeUserCode(String takeUserCode) {
        this.takeUserCode = takeUserCode;
    }

    @Length(min = 0, max = 50, message = "领文人姓名长度不能超过 50 个字符")
    public String getTakeUserName() {
        return takeUserName;
    }

    public void setTakeUserName(String takeUserName) {
        this.takeUserName = takeUserName;
    }

    @Length(min = 0, max = 50, message = "领文人警号长度不能超过 50 个字符")
    public String getTakeUserPoliceno() {
        return takeUserPoliceno;
    }

    public void setTakeUserPoliceno(String takeUserPoliceno) {
        this.takeUserPoliceno = takeUserPoliceno;
    }

    @Length(min = 0, max = 1000, message = "领文人脸识别图片路径长度不能超过 1000 个字符")
    public String getTakeUserFace() {
        return takeUserFace;
    }

    public void setTakeUserFace(String takeUserFace) {
        this.takeUserFace = takeUserFace;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getReturnDate() {
        return returnDate;
    }

    public void setReturnDate(Date returnDate) {
        this.returnDate = returnDate;
    }

    @Length(min = 0, max = 64, message = "归还人ID长度不能超过 64 个字符")
    public String getReturnUserCode() {
        return returnUserCode;
    }

    public void setReturnUserCode(String returnUserCode) {
        this.returnUserCode = returnUserCode;
    }

    @Length(min = 0, max = 50, message = "归还人姓名长度不能超过 50 个字符")
    public String getReturnUserName() {
        return returnUserName;
    }

    public void setReturnUserName(String returnUserName) {
        this.returnUserName = returnUserName;
    }

    @Length(min = 0, max = 50, message = "归还人警号长度不能超过 50 个字符")
    public String getReturnUserPoliceno() {
        return returnUserPoliceno;
    }

    public void setReturnUserPoliceno(String returnUserPoliceno) {
        this.returnUserPoliceno = returnUserPoliceno;
    }

    @Length(min = 0, max = 1000, message = "归还人脸识别图片路径长度不能超过 1000 个字符")
    public String getReturnUserFace() {
        return returnUserFace;
    }

    public void setReturnUserFace(String returnUserFace) {
        this.returnUserFace = returnUserFace;
    }

    @Length(min = 0, max = 64, message = "销毁任务ID长度不能超过 64 个字符")
    public String getDestroyTaskId() {
        return destroyTaskId;
    }

    public void setDestroyTaskId(String destroyTaskId) {
        this.destroyTaskId = destroyTaskId;
    }

    public DocRecv getDocRecv() {
        return docRecv;
    }

    public void setDocRecv(DocRecv docRecv) {
        this.docRecv = docRecv;
    }
	public Office getOffice() {
		return office;
	}

	public void setOffice(Office office) {
		this.office = office;
	}
}